<?php 
	session_start();
	include('function/connection.php');
	include('function/function.php');
	
	if(isset($_GET['action']) && $_GET['action'] == "insert"){		
		$sql="INSERT INTO tbl_customers (cus_id,cus_name,cus_address,cus_contact1, cus_contact2)
		VALUES(
			'$_POST[txtCusID]',
			'$_POST[txtCusName]',
			'$_POST[txtCusAddress]',
			'$_POST[txtCusContact1]',
			'$_POST[txtCusContact2]')";
	
		mysql_query($sql);
		pageRedirect("index.php?page=customer_list&action=customer_list_addnew&","Added successful....!");
	}
	
	if(isset($_GET['action']) && $_GET['action'] == "update"){
		$sql= "UPDATE tbl_customers SET
				cus_id = '".$_POST['txtCusID']."',
				cus_name = '".$_POST['txtCusName']."',
				cus_address = '".$_POST['txtCusAddress']."',
				cus_contact1 = '".$_POST['txtCusContact1']."',
				cus_contact2 = '".$_POST['txtCusContact2']."'
			WHERE id = $_GET[id]";
			
		mysql_query($sql);
		pageRedirect("index.php?page=customer_list&action=customer_list&","Updated successful....!");
	}
	
	if(isset($_GET['action']) && $_GET['action'] == "delete"){
		$sql = "DELETE FROM tbl_customers
				WHERE id = $_GET[id]";
				
		mysql_query($sql);		
		pageRedirect("index.php?page=customer_list&action=customer_list&","Deleted successful....!");
	}
?>